static FILE *file_in;
static FILE *file_out;
+static char *psn;
#define MYNAME "CSV"
wr_init(const char *fname, const char *args)
{
file_out = fopen(fname, "w");
+ psn = get_option(args, "prefer_shortname");
+
if (file_out == NULL) {
fatal(MYNAME ": Cannot open %s for writing\n", fname);
}
lon = wpt->position.longitude.degrees;
lat = wpt->position.latitude.degrees;
- if (wpt->description)
- description = csv_stringclean(wpt->description, ",\"");
+ if (psn) {
+ if (wpt->shortname)
+ description = csv_stringclean(wpt->shortname, ",\"");
+ } else {
+ if (wpt->description)
+ description = csv_stringclean(wpt->description, ",\"");
+ }
if ((description == NULL) && wpt->notes)
description = csv_stringclean(wpt->notes, ",\"");
waypt_add(waypoint *wpt)
{
ENQUEUE_TAIL(&waypt_head, &wpt->Q);
+ if (wpt->description == NULL) {
+ if (wpt->notes != NULL) {
+ wpt->description = xstrdup(wpt->notes);
+ }
+ }
waypt_ct++;
}